<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>easyui-demo</title>
    <link rel="stylesheet" href="/manager/easyui/themes/default/easyui.css"/>
    <link rel="stylesheet" href="/manager/easyui/themes/icon.css"/>
    <script type="text/javascript" src="/manager/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/manager/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript">
        //工具栏
        let toolbar=[{
            text:"修改",
            iconCls:"icon-edit",
            handler:function(){
                alert("edit");
            }
        },'-',{
            text:"新增",
            iconCls:"icon-add",
            handler:function(){
                alert("add");
            }
        }];
        $(function(){
              $("#tab").datagrid({
                  url:'/manager/test/findAll',
                  title:"用户列表",
                  columns:[
                      [
                      {field:'username',title:'用户名',width:100,align:"center"},
                      {field:'password',title:'密码',width:100,align:"center"},
                      {field:'phone',title:'电话',width:100,align:"center"},
                      {field:'status',title:'状态',width:100,align:"center",formatter:function (value,row,index) {
                                  if(value==null){
                                      return "启用";
                                  }
                              return "禁用";
                          }
                      },
                      {field:'createDate',title:'创建日期',width:100,align:"center"}
                  ]
                  ],
                  pagination:true,
                  singleSelect:true,
                  toolbar:"#tb"
              });
        });

        function query(){
          /*  $('#tab').datagrid({
                queryParams: {
                    name: $("#name").textbox("getValue")
                }
            });*/

           /* $('#tab').datagrid("load",{
                name: $("#name").textbox("getValue")
            });*/

           /* $('#tab').datagrid("reload",{
                name: $("#name").textbox("getValue")
            });*/

           let row = $('#tab').datagrid("getSelected");
           console.log(row);
        }
    </script>
</head>
<body>
   <table id="tab"></table>
   <!--查询栏-->
   <div id="tb" style="padding: 3px;">
      <span>名称</span>
      <input type="text" class="easyui-textbox" id="name"/>
      <a class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="query()">查询</a>
   </div>
</body>
</html>